#include <iostream>
#include <vector>
#include <string>
#include <set>
using namespace std;

// 检查两个单词是否可以通过一次操作转换
bool canTransform(const string& word, const string& dictWord) {
    int len1 = word.length();
    int len2 = dictWord.length();
    
    // 情况1：删除一个字母 (dictWord比word短1)
    if (len2 == len1 - 1) {
        int diff = 0;
        int i = 0, j = 0;
        while (i < len1 && j < len2) {
            if (word[i] != dictWord[j]) {
                if (diff > 0) return false;
                diff++;
                i++;
            } else {
                i++;
                j++;
            }
        }
        return true;
    }
    
    // 情况2：替换一个字母 (长度相同)
    if (len2 == len1) {
        int diff = 0;
        for (int i = 0; i < len1; i++) {
            if (word[i] != dictWord[i]) {
                diff++;
                if (diff > 1) return false;
            }
        }
        return diff == 1;
    }
    
    // 情况3：插入一个字母 (dictWord比word长1)
    if (len2 == len1 + 1) {
        int diff = 0;
        int i = 0, j = 0;
        while (i < len1 && j < len2) {
            if (word[i] != dictWord[j]) {
                if (diff > 0) return false;
                diff++;
                j++;
            } else {
                i++;
                j++;
            }
        }
        return true;
    }
    
    return false;
}

int main() {
    vector<string> dictionary;
    string word;
    
    // 读取字典
    while (cin >> word && word != "#") {
        dictionary.push_back(word);
    }
    
    // 处理待检查的单词
    while (cin >> word && word != "#") {
        // 检查单词是否在字典中
        bool found = false;
        for (const string& dictWord : dictionary) {
            if (word == dictWord) {
                cout << word << " is correct" << endl;
                found = true;
                break;
            }
        }
        
        if (!found) {
            // 寻找可能的替换
            vector<string> replacements;
            for (const string& dictWord : dictionary) {
                if (canTransform(word, dictWord)) {
                    replacements.push_back(dictWord);
                }
            }
            
            cout << word << ":";
            for (const string& replacement : replacements) {
                cout << " " << replacement;
            }
            cout << endl;
        }
    }
    
    return 0;
}